package com.nacrtstudio.webgiftshop.pages.admin;

import java.util.List;

import org.apache.shiro.authz.annotation.RequiresRoles;
import org.apache.tapestry5.annotations.InjectPage;
import org.apache.tapestry5.annotations.Property;
import org.apache.tapestry5.ioc.annotations.Inject;

import com.nacrtstudio.webgiftshop.facade.Controller;
import com.nacrtstudio.webgiftshop.model.shop.Order;
import com.nacrtstudio.webgiftshop.model.shop.PackedGift;
import com.nacrtstudio.webgiftshop.pages.GiftInfo;

@RequiresRoles("admin")
public class OrderReports {
	@Inject
	private Controller controller;
	
	@Property
	private Order order;
	@Property
	private PackedGift packedGift;
	
	@InjectPage
	private GiftInfo giftInfo;
	Object onActionFromShow(Long id){
		giftInfo.setGift(controller.findGift(id));
    	return giftInfo;
    }
	
	public List<Order> getAllOrders(){
		return controller.getAllOrders();
	}
	
	@InjectPage
	private EditOrder editOrder;
	Object onActionFromShowOrder(Long id){
		editOrder.setOrder(controller.findOrder(id));
    	return editOrder;
    }
}
